Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3272 update message date overnight #3573

Merged
merged 3 commits into from
Jun 14, 2021

Conversation

dklymenk
Copy link
Contributor

@dklymenk dklymenk commented Jun 13, 2021

Details

Adds a new Onyx store key for current date. The value is updated via a function throttled by 3 hours that is called on user interaction. That value is passed into ReportActionItemDate component as a prop, so it re-renders when the prop changes, causing the timestampToDate to be recalculated.

Fixed Issues

Fixes #3272

Tests

  1. Change the throttle duration from 3 hours to 15 seconds in DateUtils.js updateCurrentDate function
  2. Open a chat
  3. Send a message
  4. Change local time on your system to 23:59:50
  5. Within 15 seconds of moving your mouse around the "Today" next to the message should be updated to "Yesterday"

!!! Important !!! Don't mouse over the message itself. From my observations, It causes a re-render that is unrelated to this PR and doesn't validate that my code works. To validate this PR, please move the mouse cursor around the LHN section or other messages.

QA Steps

  1. Send a message
  2. Leave the app open overnight
  3. The day after move the mouse over the app and the "Today" next to the message should be updated to "Yesterday" (at least 3 hours must pass since last interaction with the app)

!!! Important !!! Don't mouse over the message itself. From my observations, It causes a re-render that is unrelated to this PR and doesn't validate that my code works. To validate this PR, please move the mouse cursor around the LHN section or other messages.

Tested On

The change only affects web and desktop.

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Videos of development tests. With manual system time change and a throttle timer of 15 seconds. Find system time in top right corner.

Web

3272-web.mp4

Mobile Web

3272-mweb.mp4

Desktop

3272-desktop.mp4

iOS

Android

@dklymenk dklymenk marked this pull request as ready for review June 13, 2021 10:58
@dklymenk dklymenk requested a review from a team as a code owner June 13, 2021 10:58
@MelvinBot MelvinBot requested review from francoisl and removed request for a team June 13, 2021 10:58
const updateCurrentDate = _.throttle(() => {
const currentDate = moment().format('YYYY-MM-DD');
Onyx.set(ONYXKEYS.CURRENT_DATE, currentDate);
}, 1000 * 60 * 60 * 3); // 3 hours
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why 3 hours?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nevermind, I see the context in the issue :)

@francoisl francoisl merged commit 892b546 into Expensify:main Jun 14, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging in version: 1.0.68-5🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production in version: 1.0.73-3🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If app left open overnight, messages still display that were sent "Today"
3 participants